package com.bstek.controller;

import com.bootdo.clouddocommon.utils.PageUtils;
import com.bootdo.clouddocommon.utils.Query;
import com.bstek.model.domain.MisUser;
import com.bstek.service.CommunicationService;
import org.springframework.web.bind.annotation.*;

import javax.inject.Inject;
import java.util.List;
import java.util.Map;


@RestController
public class CommunicationController {

    @Inject
    CommunicationService communicationService;

    @RequestMapping(value = "mis/Communication/getUsers" , method = RequestMethod.GET)
    public PageUtils getUsersByDeptId(@RequestParam Map<String, Object> params){
        Query query = new Query(params);
        List<MisUser> misUsers = communicationService.getUsersByDeptId(query);
        int total = communicationService.count(query);
        PageUtils page = new PageUtils(misUsers,total);
        return page;
    }

    @RequestMapping(value = "mis/Communication/saveMisUser" , method = RequestMethod.POST)
    public int saveMisUser(@RequestBody MisUser misUser){
        return communicationService.saveMisUser(misUser);
    }


    @RequestMapping(value = "mis/Communication/updateMisUser" , method = RequestMethod.PUT)
    public int updateMisUser(@RequestBody MisUser misUser){
        return communicationService.updateMisUser(misUser);
    }

    @RequestMapping(value = "mis/Communication/delMisUserByIds" , method = RequestMethod.POST)
    public int delMisUserByIds(@RequestBody Map<String, List<String>> map){
        return   communicationService.delMisUserByIds(map);
    }
}
